package com.example.javajetpacktest.viewmodel;


import android.app.Application;
import android.content.Context;

import androidx.annotation.NonNull;

import com.example.javajetpacktest.base.BaseViewModel;
import com.example.javajetpacktest.model.MainModel;

public class MainViewModel extends BaseViewModel<MainModel> {

    Context context;

    public MainViewModel(@NonNull Application application) {
        super(application);
        this.context = application;
        MainModel mainModel = new MainModel();
        mainModel.setNumber(20);
        getMutableLiveData().setValue(mainModel);
    }


    public void add() {
        int num = getMutableLiveData().getValue().getNumber();
        MainModel mainModel = getMutableLiveData().getValue();
        mainModel.setNumber(num + 1);
        getMutableLiveData().setValue(mainModel);
    }
}

